/*
 * SpecialCommandInterpreter.h
 *
 *  Created on: 2 Apr 2014
 *      Author: Christian Holzreuter
 */

#ifndef _SOLVER_SPECIALCOMMANDINTERPRETER_H
#define _SOLVER_SPECIALCOMMANDINTERPRETER_H

#include <string>
#include <vector>

namespace solver
{
	class SpecialCommandInterpreter;

	class Command;
	class ExitCommand;
	class InfoCommand;
}


class solver::SpecialCommandInterpreter
{
	static std::vector<const Command*> commands;
	static bool initialized;

	SpecialCommandInterpreter(void);
	~SpecialCommandInterpreter(void);

	static void initialize(void);
public:
	static void interpret(const std::string& input);
	static void addCommand(const Command* command);
};


class solver::Command
{
protected:
	std::string command;
public:
	Command(const std::string& command);
	virtual ~Command();
	virtual bool matches(const std::string& command) const;
	virtual void execute(const std::string& arguments) const = 0;
};


class solver::ExitCommand :
		public Command
{
public:
	ExitCommand(void);
	void execute(const std::string& arguments) const;
};


class solver::InfoCommand :
		public Command
{
public:
	InfoCommand(void);
	void execute(const std::string& arguments) const;
};


#endif // _SOLVER_SPECIALCOMMANDINTERPRETER_H
